package org.finesys.chat.core.base.mapper;

import java.util.List;

import org.finesys.ai.entity.AigcModel;
import org.finesys.chat.core.base.factory.ChatModel;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface ModelConverter {

    ModelConverter INSTANCE = Mappers.getMapper(ModelConverter.class);

    /**
     * 转换函数调用
     */
    @Mappings({
            @Mapping(target = "modelId", source = "id"),
            @Mapping(target = "model", source = "modelName"),
            @Mapping(target = "apiSecret", source = "secretKey")
    })
    ChatModel convert(AigcModel aigcModel);


    /**
     * 转换工具调用
     */
    @Mappings({
            @Mapping(target = "modelId", source = "id"),
            @Mapping(target = "model", source = "modelName"),
            @Mapping(target = "apiSecret", source = "secretKey")
    })
    List<ChatModel> convertList(List<AigcModel> aigcModelList);
}
